package com.wushi.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.wushi.entity.User;
import com.wushi.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/list")
    public List<User> list() {
        List<User> list = userService.list();
        log.info("list: {}", list);
        return list;
    }

    @PostMapping("/save")
    public boolean save(@RequestBody User user) {
        return userService.save(user);
    }
}
